//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
}
//---------------------------------------------------------------------------
String TimeToStr(FILETIME Time)
{
  WORD fd, ft;
  DWORD fdt;
  FILETIME lft;
  TDateTime dt;
  FileTimeToLocalFileTime(&Time,&lft);
  FileTimeToDosDateTime(&lft, &fd,&ft);
  dt = FileDateToDateTime(MAKELONG(ft,fd));
  return DateToStr(dt);
}
String TimeToStr(long lg)
{
  return lg;
}

void __fastcall TForm1::Button1Click(TObject *Sender)
{
  WIN32_FIND_DATA wfd;
  String NamePath,Name;
  HANDLE handle;

  if(!OpenDialog1->Execute()) return;
  Edit1->Text = OpenDialog1->FileName;
  Form1->Caption = "ȡļԣ"+Edit1->Text;
  handle = FindFirstFile(Edit1->Text.c_str(), &wfd);
  if(handle==INVALID_HANDLE_VALUE)
  {
    ShowMessage("ȷļ");
    return;
  }
  Name = wfd.cFileName;
  Label1->Caption = "       " + Name;

  NamePath = Edit1->Text;
  NamePath = NamePath.SubString(1,NamePath.Length() - Name.Length()-1);
  Label2->Caption =  "ļλã    " + NamePath;
  Label3->Caption =  "ļС    " + TimeToStr((wfd.nFileSizeHigh * MAXDWORD) + wfd.nFileSizeLow) + "  ֽ";
  Label4->Caption =  "ʱ䣺    " + TimeToStr(wfd.ftCreationTime);
  Label5->Caption =  "޸ʱ䣺    " + TimeToStr(wfd.ftLastWriteTime);
  Label6->Caption =  "ʱ䣺    " + TimeToStr(wfd.ftLastAccessTime);
 

}
//---------------------------------------------------------------------------
  //if(H!=INVALID_HANDLE_VALUE)



